<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>报名情况</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
	<c:set var="ctx" value="${pageContext.request.contextPath}" />
    <link rel="stylesheet" href="${ctx}/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="${ctx}/assets/css/style.css?v=2.3">
    <link rel="stylesheet" href="${ctx}/assets/css/index.css?v=2.3">
    <script src="${ctx}/assets/js/myAlert.js"></script>
    <script>
    	var studyId='${param.studyId}';
    </script>
</head>
<body class="bg-gray">
<header data-am-widget="header" class="am-header am-header-default am-header-fixed am-border-bottom">
    <div class="am-header-left am-header-nav">
        <a onclick="history.go(-1)"> <i class="icon_8"></i>
        </a>
    </div>
    <h1 class="am-header-title margin-baifen35" >
        报名情况
    </h1>
    <div class="am-header-right am-header-nav am-text-right font-14 width-baifen35">
    报名人数:${param.signBaomin}
    </div>
</header>
<section class="am-padding-bottom-sm" id="amz-main" data-tag="css-nav">

    <!--切换tab-->
    <div data-am-widget="tabs"
         class="am-tabs am-tabs-d2 font-14 bg-white am-margin-top-sm pinglun-tabs am-border-bottom">
        <ul class="am-tabs-nav am-cf">

            <li class="am-active bg-white">
                <div class="width-100 border-right margin-top-6 height-30"><a id="dqd">待确定</a></div>
            </li>
            <li class="bg-white">
                <div class="width-100  margin-top-6 height-30"><a id="yqd">已确定</a></div>
            </li>
        </ul>

    </div>

    <!--列表-->
    <div class="margin-top-42 order_list">
        
    </div>


</section>


<div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt">
   <div class="am-modal-dialog">
        <div class="am-modal-hd">理由</div>
        <div class="am-modal-bd">
            <textarea rows="3" class="mark_content am-modal-prompt-input" id="mark" placeholder="请填写拒绝原因，拒绝后将自动退款"></textarea>
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn" data-am-modal-cancel>取消</span>
            <span class="am-modal-btn" data-am-modal-confirm>确认</span>
        </div>
    </div>
</div>



<script src="${ctx}/assets/js/jquery.min.js"></script>
<script src="${ctx}/assets/js/amazeui.min.js"></script>


<script>
    $(function() {
    	var baomingStr=$.ajax({url:"${ctx}/getBaoming?studyId="+studyId+"&getBaoming=0",async:false});
        var baomingJson=JSON.parse(baomingStr.responseText);
        if(baomingJson.resultCode=="0"){
        	$(".order_list").html("");
        	for(var i=0;i<baomingJson.orderList.length;i++){
        	
        		var userList=$.ajax({url:"${ctx}/getUserData?userId="+baomingJson.orderList[i].userId,async:false});
       	    	var userJson=JSON.parse(userList.responseText);
        	
        		var html="";
        		//<!--待完成-->
        html+="<div class='order_item bg-white border-bottom am-margin-bottom-sm am-padding-top-sm'>";
            html+="<div onclick='window.location.href=\"${ctx}/gotoPeiXunOrderDesc?orderId="+baomingJson.orderList[i].id+"\"'>";
            html+="<div class=' bg-gray am-margin-left-sm am-margin-right-sm '>";
                html+="<div class='am-g   am-padding-top-sm am-padding-bottom-xs border-1'>";
                    html+="<div class='am-u-sm-3 am-list-thumb am-padding-left-sm'>";
                        html+=" <a class=''>";
                             html+="<img class='img-65' src='"+userJson.wxUser.headimgurl+"'/>";
                        html+=" </a>";
                         html+="<i class='icon_12'></i>";
                     html+="</div>";
                    html+="<div class=' am-u-sm-9 am-list-main'>";
                        html+="<div class='am-list-item-hd font-color-main'>";
                            html+=""+baomingJson.orderList[i].customerName;
                        html+=" </div>";

                        html+="<div class='font-12  font-color-11'>";
                             html+="                "+baomingJson.orderList[i].telephone;
                         html+="</div>";
                        html+="<div class='font-14  font-color-main am-text-truncate'>";
                        html+=" </div>";
                     html+="</div>";

                 html+="</div>";
             html+="</div>";

            html+="<div class='am-padding-left-lg am-padding-right-sm am-padding-bottom-sm'>";

                html+="<div class='box font-color-17 am-margin-top-sm'>";
                    html+="<div class='width-35px'><div class='icon_70_2'></div></div>";
                    html+="<div class='box-1  '>";
                         html+="总价：&yen;"+baomingJson.orderList[i].orderPrice;
                     html+="</div>";
                 html+="</div>";
            html+=" </div>";
			 html+="</div>";
            html+="<div class='am-padding-left-sm am-padding-right-sm font-14'>";
                html+="<div class='am-g am-text-center font-color-16 am-padding-top-xs am-padding-bottom-xs border-tops'>";
                    html+="<div class='am-u-sm-4 border-right jujue' data-id='"+baomingJson.orderList[i].id+"'><span class='prelative padding-left-15'><i class='icon_026_1'></i>拒绝报名</span></div>";
                    html+="<div class='am-u-sm-4 border-right'><span class='prelative padding-left-15'><i class='icon_027_1'></i><a href=\"tel:"+baomingJson.orderList[i].telephone+"\" style=\"color:#9A9AAB\">电联</a></span></div>";
                    html+="<div class='am-u-sm-4 jiesuan' data-id='"+baomingJson.orderList[i].id+"'><span class='prelative padding-left-15'><i class='icon_028_2'></i>同意报名</span></div>";
                html+="</div>";
            html+="</div>";

        html+="</div>";
        
        	$(".order_list").append(html);	
        		
        	}
        }
    
    	$("#yqd").on('click', function() {
    		var baomingStr=$.ajax({url:"${ctx}/getBaoming?studyId="+studyId+"&getBaoming=1",async:false});
        var baomingJson=JSON.parse(baomingStr.responseText);
        if(baomingJson.resultCode=="0"){
        	$(".order_list").html("");
        	for(var i=0;i<baomingJson.orderList.length;i++){
        	
        		var userList=$.ajax({url:"${ctx}/getUserData?userId="+baomingJson.orderList[i].userId,async:false});
       	    	var userJson=JSON.parse(userList.responseText);
        	
        		var html="";
        		//<!--待完成-->
        html+="<div class='order_item bg-white border-bottom am-margin-bottom-sm am-padding-top-sm'>";
            html+="<div onclick='window.location.href=\"${ctx}/gotoPeiXunOrderDesc?orderId="+baomingJson.orderList[i].id+"\"'>";
            html+="<div class=' bg-gray am-margin-left-sm am-margin-right-sm '>";
                html+="<div class='am-g   am-padding-top-sm am-padding-bottom-xs border-1'>";
                    html+="<div class='am-u-sm-3 am-list-thumb am-padding-left-sm'>";
                        html+=" <a class=''>";
                             html+="<img class='img-65' src='"+userJson.wxUser.headimgurl+"'/>";
                        html+=" </a>";
                         html+="<i class='icon_12'></i>";
                     html+="</div>";
                    html+="<div class=' am-u-sm-9 am-list-main'>";
                        html+="<div class='am-list-item-hd font-color-main'>";
                            html+=""+baomingJson.orderList[i].customerName;
                        html+=" </div>";

                        html+="<div class='font-12  font-color-11'>";
                             html+="                "+baomingJson.orderList[i].telephone;
                         html+="</div>";
                        html+="<div class='font-14  font-color-main am-text-truncate'>";
                        html+=" </div>";
                     html+="</div>";

                 html+="</div>";
             html+="</div>";

            html+="<div class='am-padding-left-lg am-padding-right-sm am-padding-bottom-sm'>";

                html+="<div class='box font-color-17 am-margin-top-sm'>";
                    html+="<div class='width-35px'><div class='icon_70_2'></div></div>";
                    html+="<div class='box-1  '>";
                         html+="总价：&yen;"+baomingJson.orderList[i].orderPrice;
                     html+="</div>";
                 html+="</div>";
            html+=" </div>";
			 html+="</div>";
        html+="</div>";
        	$(".order_list").append(html);	
        		
        	}
        }
    	});
    	
    	$("#dqd").on('click', function() {
    		location.reload(true);
    	});
    
        $('.order_list').find('.jujue').on('click', function() {

            $('#my-prompt').modal({
                relatedTarget: this,
                onConfirm: function(options) {
                    var $link = $(this.relatedTarget);
                    var orderId=$link.data('id');
                    var mark=$("#mark").val();
					var orderStr=$.ajax({url:"${ctx}/updatePeixunOrder?mark="+mark+"&openType=0&orderId="+orderId,async:false});
		       	    var orderJson=JSON.parse(orderStr.responseText);
		       	    if(orderJson.resultCode=="0"){
		       	    	location.reload(true);   
		       	    }else{
		       	    	myAlert(orderJson.resultDesc);
		       	    }
                    
                },
                onCancel: function() {

                }
            });
        });
        $('.order_list').find('.jiesuan').on('click', function() {
        
			var orderId=$(this).data('id');
			var orderStr=$.ajax({url:"${ctx}/updatePeixunOrder?openType=1&orderId="+orderId,async:false});
       	    var orderJson=JSON.parse(orderStr.responseText);
       	    if(orderJson.resultCode=="0"){
       	    	location.reload(true);   
       	    }else{
       	    	myAlert(orderJson.resultDesc);
       	    }
        });


    });
</script>

</body>
</html>